FROM python:3.7-slim-buster

COPY sources.list /etc/apt/sources.list

ENV DEBIAN_FRONTEND=noninteractive
ENV PYTHONIOENCODING=UTF-8
ENV TZ=Asia/Shanghai
ENV WORKDIR=/open_api

EXPOSE 8000

COPY ./ $WORKDIR

COPY ./.env_sample $WORKDIR/.env

WORKDIR $WORKDIR

RUN apt update && apt install -y tzdata locales gcc && pip3 install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple/

RUN echo "Asia/Shanghai" > /etc/timezone && rm -f /etc/localtime && dpkg-reconfigure -f noninteractive tzdata

# 日志
VOLUME $WORKDIR/applog

CMD ["uvicorn", "app.main:app", "--log-level", "info", "--host", "0.0.0.0", "--port", "8000"]